<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>指尖改变世界 - 科技始终来源于人性</title><meta name="keywords" content="沙屿沫个人博客,沙屿沫,shayvmo,php"><meta name="author" content="沙屿沫"><meta name="copyright" content="沙屿沫"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="科技始终来源于人性">
<meta property="og:type" content="website">
<meta property="og:title" content="指尖改变世界">
<meta property="og:url" content="http://blog.shayvmo.cn/page/6/index.html">
<meta property="og:site_name" content="指尖改变世界">
<meta property="og:description" content="科技始终来源于人性">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://blog.shayvmo.cn/images/avatar.jpg">
<meta property="article:author" content="沙屿沫">
<meta property="article:tag" content="沙屿沫个人博客,沙屿沫,shayvmo,php">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://blog.shayvmo.cn/images/avatar.jpg"><link rel="shortcut icon" href="/images/avatar.jpg"><link rel="canonical" href="http://blog.shayvmo.cn/page/6/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?5e4d1e8fcc524b4e732ea58fa9fa15f0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '指尖改变世界',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-06-05 17:19:25'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src= "" data-lazy-src="/images/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">74</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">42</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">15</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/images/bg/kobe.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">指尖改变世界</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">指尖改变世界</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/18/md5-file/" title="文件的md5和sha1值的用处">     <img class="post_bg" src= "" data-lazy-src="/images/84d4f0153d8f39838898072a04acfcc812.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="文件的md5和sha1值的用处"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/18/md5-file/" title="文件的md5和sha1值的用处">文件的md5和sha1值的用处</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-18T03:51:44.000Z" title="发表于 2020-05-18 11:51:44">2020-05-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">熟悉公众号的小伙伴，应该知道里面后台素材库这个板块的内容。而我们在网站后台的开发时，也会用到资源库的概念。
资源库，是指把所有用户上传的文件记录起来的地方，比如说文件类型，大小，存放位置等等；
当我们需要避免用户重复上传，或者实现秒传，检验文件完整性等场景的时候，就要用到能够标识出这个文件的唯一标识，这个时候，就可以用到文件的md5值，或者哈希值。每个文件的每个状态都对应特定的值，我们可以通过比对这个值，来实现上述的3个场景
【场景】避免重复上传
同一个文件，用户可能在不同的场景下上传多次，如果我们不对此进行相应的检验、去重，服务器的文件数量会越来越多，同时一些无效的文件也会保存在服务器上，造成空间浪费
实现秒传
秒传，实际上是和第一个场景提到的问题延伸。当用户不同场景上传同一个文件时，我们可以先检验资源库里面是否有这个文件，有则直接返回相对的资源路径，减少客户端等待的时间
校验文件完整性
在某些场景下，比如文档状态记录时，可能会需要比对当前文件是否无改动，这时候，就可以采用检验前后文件加密值的方式来进行区分文件是否未被修改
【实现思路】1、建立资源表，用于保存文件相关信息，如文件类型 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/18/checkbox/" title="jQuery全选和反选CheckBox">     <img class="post_bg" src= "" data-lazy-src="/images/edaab092aef93e8a9e83920408c1381321.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="jQuery全选和反选CheckBox"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/18/checkbox/" title="jQuery全选和反选CheckBox">jQuery全选和反选CheckBox</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-18T03:51:19.000Z" title="发表于 2020-05-18 11:51:19">2020-05-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></span></div><div class="content">近日在项目维护中，前端页面涉及到了复选框，于是记录一下如何使用 jQuery 实现 CheckBox 的全选和反选。
1、checkBox&lt;input type=&#x27;checkbox&#x27; onclick=&#x27;checkAll(this)&#x27; /&gt;&lt;input type=&#x27;checkbox&#x27; name=&#x27;expense_cate&#x27; value=&#x27;&#x27; /&gt;;

2、javascript 部分//全选和反选function checkAll(obj) &#123;     let check_status = obj.checked;     $(&#x27;[name=expense_cate]:checkbox&#x27;).each(function()&#123;        this.checked = check_status;     &#125;);&#125;//选中的复选框值function get_expense_cate() &#123;    var ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/18/sitemap/" title="什么是sitemap?究竟有什么作用呢？">     <img class="post_bg" src= "" data-lazy-src="/images/sitemap.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="什么是sitemap?究竟有什么作用呢？"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/18/sitemap/" title="什么是sitemap?究竟有什么作用呢？">什么是sitemap?究竟有什么作用呢？</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-18T03:47:52.000Z" title="发表于 2020-05-18 11:47:52">2020-05-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">sitemap即网站地图，存储网站所有网址url的索引，用于通知搜索引擎网站上有哪些可供抓取的网页。
【sitemap.xml】即网站地图，存储网站所有网址url的索引，用于通知搜索引擎网站上有哪些可供抓取的网页。
一般放置在网站根目录，通过域名 + sitemap.xml的形式访问，如http://www.shayvmo.top/sitemap.xml
常见的sitemap文件格式有xml、txt，一般使用xml即可，百度、谷歌等主流搜索引擎都是使用xml文件
网站地图的主要作用是告诉搜索引擎网站可供访问的url链接，以及最近更新网页信息，便于搜索引擎抓取收录，因此对于网站的排名具有积极意义。
【sitemap 生成】参考以下链接：
http://www.sitemap-xml.org/
【robots.txt】搜索引擎使用spider程序自动范文互联网上的网页并获取网页信息。
robots.txt 这个文件用于指定spider在您网站上的抓取范围，可以 定义哪些目录抓取，哪些目录禁止抓取。
【用法】User-agent：定义进制搜索引擎名字，比如说：百度（Baiduspider）、 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/18/baidu-static/" title="为自己的网站添加百度统计">     <img class="post_bg" src= "" data-lazy-src="/images/95a27239b3ecf215308856745f54066414.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="为自己的网站添加百度统计"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/18/baidu-static/" title="为自己的网站添加百度统计">为自己的网站添加百度统计</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-18T03:43:41.000Z" title="发表于 2020-05-18 11:43:41">2020-05-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">网站上线后，往往需要统计网站的访问情况，SEO效果等等。
我们可以通过百度统计，来查看我们的网站在百度引擎的SEO情况。
那如何网站怎样才能引入百度统计呢？
【步骤】1、首先进入百度统计网站，注册或登录账号。
https://tongji.baidu.com/web/welcome/login
2、添加待统计的网站，安装统计代码到网站中需要统计的页面


3、一般情况下，20分钟后自动生效，也可以根据提示，进行手动代码检查，检测是否安装成功。
【注意】如果需要把统计数据公开，则可以通过以下方式进行开放。

</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/03/04/console/" title="公众号页面开发添加调试器">     <img class="post_bg" src= "" data-lazy-src="/images/b3bfa975a80b0b43a745e30f2edc14be61.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="公众号页面开发添加调试器"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/03/04/console/" title="公众号页面开发添加调试器">公众号页面开发添加调试器</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-03-04T13:10:22.000Z" title="发表于 2020-03-04 21:10:22">2020-03-04</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></span></div><div class="content">开发公众号页面时，面对真机页面测试，有时候需要查看页面加载情况，这里可以加载一个调试器，进行调试处理。
首先引入js文件，https://cdn.jsdelivr.net/npm/vconsole@3.3.4/dist/vconsole.min.js
然后在脚本中实例化类
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/vconsole@3.3.4/dist/vconsole.min.js&quot;&gt;&lt;script&gt;new VConsole();&lt;/script&gt;

实际效果

</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/03/03/phpstorm/" title="2019.3.2 版本 PHPStorm 最新激活方式 （2020年亲测）">     <img class="post_bg" src= "" data-lazy-src="/images/phpstorm/0.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="2019.3.2 版本 PHPStorm 最新激活方式 （2020年亲测）"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/03/03/phpstorm/" title="2019.3.2 版本 PHPStorm 最新激活方式 （2020年亲测）">2019.3.2 版本 PHPStorm 最新激活方式 （2020年亲测）</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-03-03T13:10:22.000Z" title="发表于 2020-03-03 21:10:22">2020-03-03</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">
【严肃声明】1、本教程补丁、激活码来源于网络，如有侵权请联系作者删除！2、本项目只做个人学习研究之用，不得用于商业用途！3、若资金允许，请点击 链接 购买正版，谢谢合作！
【激活注意】1、本文适用于PHPstorm 2019.3.2（亲测成功），其他版本待大家测试使用，由于是使用最新 jar 包，相信激活问题不大。
2、修改后配置，重启IDE，输入相应激活码
3、不需要修改 host 文件以及任何配置文件
题外，Windows host 路径：C:\Windows\System32\drivers\etc
【激活步骤】1、正常下载，安装PHPstorm，官方下载渠道：https://www.jetbrains.com/phpstorm/download/
2、下载激活 jar 包
下载完成后，将 jar 包放在任意目录下，路径不得有中文，并记下这个路径，后续配置时需要用到。建议存放妥当。
链接：https://pan.baidu.com/s/1uuVQy8IvJrgFzPg0wSL2yQ提取码：lp50
3、打开 PHPstorm ，首次安装打开时，选择 Evaluate for f ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2019/11/09/function1/" title="PHP 返回一维数组中，有序组合成 N 个元素的数组">     <img class="post_bg" src= "" data-lazy-src="/images/420e7cbd02507bcbe39236a3b384a59f17.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="PHP 返回一维数组中，有序组合成 N 个元素的数组"></a></div><div class="recent-post-info"><a class="article-title" href="/2019/11/09/function1/" title="PHP 返回一维数组中，有序组合成 N 个元素的数组">PHP 返回一维数组中，有序组合成 N 个元素的数组</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-09T02:16:23.000Z" title="发表于 2019-11-09 10:16:23">2019-11-09</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">最近业务上遇到一个商品捆绑促销的问题，需要计算出一维数组中组合成2个有序不重复的元素组合数组。
于是总结了一下，写了一个可以通用算多一维数组中，组成有序组合数组的函数。
函数方法/** * 返回一维数组中，有序组合成 $count 个元素的数组 * @author Eric * @param $arr 原数组 * @param $collect 组成新数组 * @param int $count 新数组单元素组合个数 * @return array */function array_picker($arr,&amp;$collect,$count=2) &#123;    if (empty($arr)) &#123;        return $collect;    &#125;    static $temp_string;    for ($i=0; $i &lt; count($arr); $i++) &#123;        $temp_string[] = $arr[$i];        if(count($temp_string) &lt; $count) &#1 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2019/10/25/php-array/" title="php 遍历数组的几种方式">     <img class="post_bg" src= "" data-lazy-src="/images/php.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="php 遍历数组的几种方式"></a></div><div class="recent-post-info"><a class="article-title" href="/2019/10/25/php-array/" title="php 遍历数组的几种方式">php 遍历数组的几种方式</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-10-25T09:38:46.000Z" title="发表于 2019-10-25 17:38:46">2019-10-25</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">最近恰好看到了 PHP 循环数组有多种方式，于是便总结一下这几种日常开发中，使用比较频繁的方式。
  

1、for只支持索引数组，不支持关联数组
$array = [&#x27;a&#x27;,&#x27;b&#x27;,&#x27;c&#x27;,&#x27;d&#x27;];for ($i=0;$i&lt;count($array);$i++)&#123;    echo $array[$i].&#x27;-&#x27;;&#125;



2、foreach索引数组和关联数组都可以
foreach ($array as $key =&gt; $value)&#123;    echo $value.&#x27;-&#x27;;&#125;



3、while(), list(), each() 结合实质上是指针移动；支持索引数组和关联数组
注意：each() 在7.2以上版本已被弃用，会报 warning 警告错误
while ( list($key,$value)=each($array) )&#123;    echo &#x27;|&#x27;.$value.&#x27 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2019/10/07/php-excel/" title="php-excel、phpspreadsheet的封装类">     <img class="post_bg" src= "" data-lazy-src="/images/php.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="php-excel、phpspreadsheet的封装类"></a></div><div class="recent-post-info"><a class="article-title" href="/2019/10/07/php-excel/" title="php-excel、phpspreadsheet的封装类">php-excel、phpspreadsheet的封装类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-10-07T07:18:33.000Z" title="发表于 2019-10-07 15:18:33">2019-10-07</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">最近项目遇到了经常性使用表格导出，之前使用的是PHPExcel，但是已经不更新了。于是开始使用PHPspreadsheet，并且在空闲时间写了一个封装类。如果有需要，可以在下载使用。遇到BUG问题，可以讨论完善。
1、composer 加载包composer require shayvmo/php-excel


2、github 地址地址：https://github.com/shayvmo/phpExcel
3、部分代码$excel = new \shayvmo\phpExcel([    &#x27;savePath&#x27;=&gt;&#x27;D:\wamp64\www\phpExcel\Examples&#x27;,//保存路径    &#x27;filename&#x27;=&gt;&#x27;test_file&#x27;.time(),    &#x27;properties&#x27;=&gt;[        &#x27;Creator&#x27;=&gt;&#x27;Eric&#x27;,//文件创建者        &#x27;LastModifiedBy& ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2019/09/24/curl-77/" title="php curl 请求 https 接口时，返回错误码：77">     <img class="post_bg" src= "" data-lazy-src="/images/curl.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="php curl 请求 https 接口时，返回错误码：77"></a></div><div class="recent-post-info"><a class="article-title" href="/2019/09/24/curl-77/" title="php curl 请求 https 接口时，返回错误码：77">php curl 请求 https 接口时，返回错误码：77</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-09-24T10:13:43.000Z" title="发表于 2019-09-24 18:13:43">2019-09-24</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">错误情况php CURL 请求一个 https 的接口时，返回一个bool false，打印错误curl_error($ch)信息时没有返回错误内容
查看错误码curl_errno($ch) 是 77 。
根据 curl 错误码显示，77 代表 &#39;CURLE_SSL_CACERT_BADFILE&#39; ，本地 CA 证书有异常。
解决方式1、服务器更新 CA 证书
yum update ca-certificates

2、重启 php-fpm 或重启 APACHE
3、curl 请求中加上忽略证书
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/5/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/5/#content-inner">5</a><span class="page-number current">6</span><a class="page-number" href="/page/7/#content-inner">7</a><a class="page-number" href="/page/8/#content-inner">8</a><a class="extend next" rel="next" href="/page/7/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src= "" data-lazy-src="/images/avatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">沙屿沫</div><div class="author-info__description">科技始终来源于人性</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">74</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">42</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">15</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/shayvmo"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">生活就像海洋，只有意志坚强的人才能到达彼岸。</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/06/05/webman-route-annotation/" title="webman 框架 注解路由插件"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="webman 框架 注解路由插件"/></a><div class="content"><a class="title" href="/2023/06/05/webman-route-annotation/" title="webman 框架 注解路由插件">webman 框架 注解路由插件</a><time datetime="2023-06-05T07:04:07.000Z" title="发表于 2023-06-05 15:04:07">2023-06-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/29/nginx-reload-not-effect/" title="windows服务器重载nginx配置无效"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="windows服务器重载nginx配置无效"/></a><div class="content"><a class="title" href="/2023/05/29/nginx-reload-not-effect/" title="windows服务器重载nginx配置无效">windows服务器重载nginx配置无效</a><time datetime="2023-05-29T08:03:45.000Z" title="发表于 2023-05-29 16:03:45">2023-05-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/24/php-aes/" title="前后端接口传输AES加密"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="前后端接口传输AES加密"/></a><div class="content"><a class="title" href="/2023/05/24/php-aes/" title="前后端接口传输AES加密">前后端接口传输AES加密</a><time datetime="2023-05-24T07:00:39.000Z" title="发表于 2023-05-24 15:00:39">2023-05-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/08/16/yar-demo/" title="Yar拓展，实现PHP的RPC服务"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Yar拓展，实现PHP的RPC服务"/></a><div class="content"><a class="title" href="/2022/08/16/yar-demo/" title="Yar拓展，实现PHP的RPC服务">Yar拓展，实现PHP的RPC服务</a><time datetime="2022-08-16T09:30:43.000Z" title="发表于 2022-08-16 17:30:43">2022-08-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/08/15/my-online-log/" title="线上日志系统"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="线上日志系统"/></a><div class="content"><a class="title" href="/2022/08/15/my-online-log/" title="线上日志系统">线上日志系统</a><time datetime="2022-08-15T09:03:01.000Z" title="发表于 2022-08-15 17:03:01">2022-08-15</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Go/"><span class="card-category-list-name">Go</span><span class="card-category-list-count">4</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Hexo/"><span class="card-category-list-name">Hexo</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Linux/"><span class="card-category-list-name">Linux</span><span class="card-category-list-count">9</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Memcached/"><span class="card-category-list-name">Memcached</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/MySQL/"><span class="card-category-list-name">MySQL</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/PHP/"><span class="card-category-list-name">PHP</span><span class="card-category-list-count">23</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Redis/"><span class="card-category-list-name">Redis</span><span class="card-category-list-count">1</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/AES/" style="font-size: 1.1em; color: #999">AES</a> <a href="/tags/Apache/" style="font-size: 1.1em; color: #999">Apache</a> <a href="/tags/Curl/" style="font-size: 1.1em; color: #999">Curl</a> <a href="/tags/Go/" style="font-size: 1.37em; color: #99a4b2">Go</a> <a href="/tags/Hexo/" style="font-size: 1.37em; color: #99a4b2">Hexo</a> <a href="/tags/Laravel/" style="font-size: 1.1em; color: #999">Laravel</a> <a href="/tags/Linux/" style="font-size: 1.1em; color: #999">Linux</a> <a href="/tags/MD5/" style="font-size: 1.1em; color: #999">MD5</a> <a href="/tags/MySQL/" style="font-size: 1.37em; color: #99a4b2">MySQL</a> <a href="/tags/Nginx/" style="font-size: 1.23em; color: #999ea6">Nginx</a> <a href="/tags/PHP/" style="font-size: 1.5em; color: #99a9bf">PHP</a> <a href="/tags/Paypal/" style="font-size: 1.1em; color: #999">Paypal</a> <a href="/tags/PhpStorm/" style="font-size: 1.1em; color: #999">PhpStorm</a> <a href="/tags/Python/" style="font-size: 1.1em; color: #999">Python</a> <a href="/tags/RESTfulAPI/" style="font-size: 1.1em; color: #999">RESTfulAPI</a> <a href="/tags/RPC/" style="font-size: 1.1em; color: #999">RPC</a> <a href="/tags/Redis/" style="font-size: 1.1em; color: #999">Redis</a> <a href="/tags/SVN/" style="font-size: 1.1em; color: #999">SVN</a> <a href="/tags/Ubuntu/" style="font-size: 1.37em; color: #99a4b2">Ubuntu</a> <a href="/tags/Vagrant/" style="font-size: 1.23em; color: #999ea6">Vagrant</a> <a href="/tags/Websocket/" style="font-size: 1.1em; color: #999">Websocket</a> <a href="/tags/Yii/" style="font-size: 1.1em; color: #999">Yii</a> <a href="/tags/composer/" style="font-size: 1.1em; color: #999">composer</a> <a href="/tags/element/" style="font-size: 1.23em; color: #999ea6">element</a> <a href="/tags/git/" style="font-size: 1.1em; color: #999">git</a> <a href="/tags/jquery/" style="font-size: 1.1em; color: #999">jquery</a> <a href="/tags/memcached/" style="font-size: 1.1em; color: #999">memcached</a> <a href="/tags/postman/" style="font-size: 1.1em; color: #999">postman</a> <a href="/tags/sitemap/" style="font-size: 1.1em; color: #999">sitemap</a> <a href="/tags/thinkphp6/" style="font-size: 1.1em; color: #999">thinkphp6</a> <a href="/tags/vue/" style="font-size: 1.1em; color: #999">vue</a> <a href="/tags/webhooks/" style="font-size: 1.1em; color: #999">webhooks</a> <a href="/tags/webman/" style="font-size: 1.1em; color: #999">webman</a> <a href="/tags/%E5%85%AC%E4%BC%97%E5%8F%B7%E8%B0%83%E8%AF%95%E5%99%A8/" style="font-size: 1.1em; color: #999">公众号调试器</a> <a href="/tags/%E5%86%92%E6%B3%A1%E6%8E%92%E5%BA%8F/" style="font-size: 1.1em; color: #999">冒泡排序</a> <a href="/tags/%E5%8D%9A%E5%AE%A2%E8%BF%81%E7%A7%BB/" style="font-size: 1.1em; color: #999">博客迁移</a> <a href="/tags/%E5%9B%BE%E7%89%87%E8%BD%ACbase64/" style="font-size: 1.1em; color: #999">图片转base64</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 1.1em; color: #999">工具</a> <a href="/tags/%E5%B9%82%E7%AD%89/" style="font-size: 1.1em; color: #999">幂等</a> <a href="/tags/%E6%B3%9B%E5%9E%8B/" style="font-size: 1.1em; color: #999">泛型</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/06/"><span class="card-archive-list-date">六月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/05/"><span class="card-archive-list-date">五月 2023</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/08/"><span class="card-archive-list-date">八月 2022</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/06/"><span class="card-archive-list-date">六月 2022</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/05/"><span class="card-archive-list-date">五月 2022</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/01/"><span class="card-archive-list-date">一月 2022</span><span class="card-archive-list-count">6</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/08/"><span class="card-archive-list-date">八月 2021</span><span class="card-archive-list-count">1</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">74</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2019-08-27T16:00:00.000Z"></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">30.9k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-06-05T09:19:25.031Z"></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/images/bg/kobe.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2023 By 沙屿沫</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="http://www.beian.miit.gov.cn/" target="_blank" rel="noopener"><img class="icp-icon" src= "" data-lazy-src="/images/icp.png"><span>粤ICP备18133330号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function subtitleType () {
  if (true) { 
    var typed = new Typed("#subtitle", {
      strings: "生活就像海洋，只有意志坚强的人才能到达彼岸".split(","),
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = '生'
  }
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" data-mobile="false" data-text="富强,民主,文明,和谐,自由,平等,公正,法治,爱国,敬业,诚信,友善" data-fontsize="15px" data-random="false" async="async"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>